package goodsShop;
import java.util.Stack;

public class GoodsShop {
	Stack<String> goodss = new Stack<String>();
	
	public synchronized void push(String goods){
		goodss.add(goods);
		notifyAll();
	}
	
	public synchronized String pop(){
		if(0 == goodss.size()){
			try {
				wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			return null;
		}else{
			return goodss.pop();
		}
	}
}
